package br.cin.ufpe.corba.iiop;

import java.io.IOException;
import java.io.InputStream;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.OutputStream;

import br.cin.ufpe.corba.SystemException;

public class SystemExceptionReplyBody implements ReplyBody {

	private SystemException exception;
	
	public SystemExceptionReplyBody(SystemException exception) {
		this.exception = exception;
	}

	public SystemException getException() {
		return this.exception;
	}

	public static ReplyBody read(InputStream inputStream) throws IOException, ClassNotFoundException {
		ObjectInputStream dis = new ObjectInputStream(inputStream);		
		return new SystemExceptionReplyBody((SystemException) dis.readObject());
	}

	public void write(OutputStream outputStream) throws IOException {
		ObjectOutputStream dos = new ObjectOutputStream(outputStream);
		dos.writeObject(getException());
	}

}
